function addStageGain(main, stageType, stageID, wa, wp, w0)

stageToEdit = ['stage' num2str(stageID)];

switch stageType
    
    case 1 % Pasa Banda
        
        [MAG, PHASE, W] = bode(main.(stageToEdit).stageTransferFunction);

        MAG = max(20*log10(MAG(:,:)));
        
        main.(stageToEdit).KtoAdd = 10^(-MAG/20);
        
        main.(stageToEdit).stageTransferFunction = main.(stageToEdit).stageTransferFunction * main.(stageToEdit).KtoAdd;
        
    case 2 % Low Pass
        
        [MAG, PHASE, W] = bode(main.(stageToEdit).stageTransferFunction, 0.0001);

        MAG = 20*log10(MAG(:,:));
        
        main.(stageToEdit).KtoAdd = 10^(-MAG/20);
        
        main.(stageToEdit).stageTransferFunction = main.(stageToEdit).stageTransferFunction * main.(stageToEdit).KtoAdd;
        
    case 3 % High Pass
        
        [MAG, PHASE, W] = bode(main.(stageToEdit).stageTransferFunction, 1000*wp);

        MAG = 20*log10(MAG(:,:));
        
        main.(stageToEdit).KtoAdd = 10^(-MAG/20);
        
        main.(stageToEdit).stageTransferFunction = main.(stageToEdit).stageTransferFunction * main.(stageToEdit).KtoAdd;
        
    case 4 % Band Reject
        
        [MAG, PHASE, W] = bode(main.(stageToEdit).stageTransferFunction, 0.0001);

        MAG = 20*log10(MAG(:,:));
        
        main.(stageToEdit).KtoAdd = 10^(-MAG/20);
        
        main.(stageToEdit).stageTransferFunction = main.(stageToEdit).stageTransferFunction * main.(stageToEdit).KtoAdd;
        
        
        
end



end